import lazyLoadView from '@/router/lazy-load';
import { DEFAULT_LAYOUT } from '../base';
import { AppRouteRecordRaw } from '../types';

const DEVICE: AppRouteRecordRaw = {
  path: '/device-management',
  name: 'DeviceManagement',
  component: DEFAULT_LAYOUT,
  meta: {
    locale: 'menu.device',
    requiresAuth: true,
    icon: 'icon-mobile',
    order: 3,
    roleCode: 'GROUP_DEVICE_ADMIN',
  },
  children: [
    {
      path: 'device-list',
      name: 'DeviceList',
      component: lazyLoadView(
        () => import('@/views/device-management/device/index.vue')
      ),
      meta: {
        locale: 'menu.device.deviceList',
        requiresAuth: true,
        roleCode: 'GROUP_DEVICE',
        pageName: '设备列表',
      },
    },
    {
      path: 'device-detail',
      name: 'DeviceDetail',
      meta: {
        locale: 'menu.device.deviceDetail',
        requiresAuth: true,
        roleCode: 'GROUP_DEVICE',
        hideInMenu: true,
        extra: true,
        layout: 'detail',
      },
      component: lazyLoadView(
        () => import('@/views/device-management/device/detail.vue')
      ),
    },
    {
      path: 'operation-monitoring',
      name: 'OperationMonitoring',
      component: lazyLoadView(
        () => import('@/views/device-management/operation-monitoring/index.vue')
      ),
      meta: {
        locale: 'menu.device.operationMonitoring',
        requiresAuth: true,
        roleCode: 'GROUP_DEVICE_MONITOR',
        pageName: '监控列表',
      },
    },
  ],
};

export default DEVICE;
